#include <iostream>
using namespace std;

typedef struct LNode {
  int data;
  LNode *next;
} LNode;

void reprint(LNode *L) {
    if (L != nullptr) {
      reprint(L->next);
      cout << L->data<<" ";
    }
}

void CreateList(LNode *&head, const int arr[], const int length) {
    head = static_cast<LNode *>(malloc(sizeof(LNode)));
    head -> next = nullptr;
    LNode *p = head;
    for (int i = 0; i < length; i++) {
        auto *q = static_cast<LNode *>(malloc(sizeof(LNode)));
        q -> data = arr[i];
        q -> next = nullptr;
        p -> next = q;
        p = q;
    }
}

int main() {
    const int arr[] = {1,3,4,5,8,6};
    LNode *head;
    CreateList(head,arr,size(arr));
    reprint(head->next);
    return 0;
}